package com.example.smart_campus.service.impl;


import com.example.smart_campus.dao.CoursesMapper;
import com.example.smart_campus.pojo.entity.CourseSelection;
import com.example.smart_campus.pojo.entity.Courses;
import com.example.smart_campus.service.CoursesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.relational.core.sql.In;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


/**
 * <p>
 * 课程表，存储课程的基本信息 服务实现类
 * </p>
 *
 * @author liyv
 * @since 2024-10-19
 */
@Service
public  class CoursesServiceImpl  implements CoursesService {

    @Autowired
    private CoursesMapper coursesMapper;

    @Override
    public void insertCourse(String courseNo, String courseName, float credits, Integer teacherId, String courseIntroduction) {

        coursesMapper.insertCourse(courseNo, courseName, credits, teacherId, courseIntroduction);

    }


    @Override
    public void updateCourse(Courses course) {
        if (course == null || course.getCourseId() == null) {
            throw new IllegalArgumentException("Course and Course ID must not be null");
        }
        coursesMapper.updateCourse(course);
    }

    @Override
    public List<CourseSelection> chosenCourse(Integer studentId) {
        List<CourseSelection> selections = coursesMapper.chosenCourse(studentId);
        return selections;
    }

//    public List<Courses> getSelectCourses() {
//        return coursesMapper.getSelectCourses();
//    }
//
//    @Override
//    public void insertSelect(Integer courseId,Integer studentId) {
//
//        coursesMapper.insertSelect(courseId,studentId);
//
//    }
//
//    public List<CourseSelection> getChosen(Integer courseId) {
//        List<CourseSelection> selections = coursesMapper.getChosen(courseId);
//        return selections;
//    }


}
